package beanAction;

import java.util.List;

import packhib.Poste;
import packhib.PosteDAO;
import packhib.ServicePoste;

import com.opensymphony.xwork2.ActionSupport;

public class AjouterPoste  extends ActionSupport{
	
	private static final long serialVersionUID = 1L;
	private String libelle;
	private String description;
	private int idPoste;
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public int getIdPoste() {
		return idPoste;
	}
	public void setIdPoste(int idPoste) {
		this.idPoste = idPoste;
	}
	public String getLibelle() {
		return libelle;
	}
	public void setLibelle(String libelle) {
		this.libelle = libelle;
	}
	
	public String enregistrerPoste()
	{
	 	Poste poste=new Poste();
	 	poste.setDescription(getDescription());
	 	poste.setLibelle(getLibelle());
	 	ServicePoste servPost=new ServicePoste();
	 	List listePoste=servPost.listPoste();
	 	int nbrPoste=listePoste.size();
	 	poste.setIdPoste(nbrPoste+1);
	 	
	 	servPost.add(poste);
	 	return "success";
		
		
	}

}
